package com.atguigu.day31.filter06;


import jakarta.servlet.*;

import java.io.IOException;
import java.time.LocalDateTime;

public class FilterA implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        // Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("开始执行:" + LocalDateTime.now());
        long start = System.currentTimeMillis();
        //请求放行
        filterChain.doFilter(servletRequest, servletResponse);
        long end = System.currentTimeMillis();
        System.out.println("结束执行:" + LocalDateTime.now()+",用时:"+(end-start));
    }

    @Override
    public void destroy() {
        //  Filter.super.destroy();
    }
}
